<template>
  <!-- <div>
    <div class="list-btn">
      <Input v-model.trim="params.realname" placeholder="请输入姓名" style="width: 200px" clearable @keyup.enter.native="getList(url)" />
      <Input v-model.trim="params.phone" placeholder="请输入手机号" style="width: 200px" clearable @keyup.enter.native="getList(url)" />
      <Input v-model.trim="params.nid" placeholder="请输入订单号" style="width: 200px" clearable @keyup.enter.native="getList(url)" />
      <DatePicker type="date" @on-change="startTime"  placeholder="选择开始时间" style="width: 200px" ></DatePicker>
      <DatePicker type="date" @on-change="endTime"  placeholder="选择结束时间" style="width: 200px"  ></DatePicker>
      <Button type="primary" @click="getList(url,'refresh')">搜索</Button>
    </div>
    <page-list :listTitle="listTitle" :list="list" :loading="loading" @selectItem="ids = $event;"></page-list>
    <page-button :current="params.pageCurrent"  :total="total" @changePageNum="params.pageCurrent = $event; getList(url)" @changePageSize="params.pageLimit = $event; getList(url)"></page-button>
  </div> -->
  <div>
    <div class="list-btn">
      姓名:<Input v-model.trim="params.realname" placeholder="请输入姓名" style="width: 200px" clearable @keyup.enter.native="getList(url)" />
    </div>
    <div class="list-btn">
      手机号:<Input v-model.trim="params.phone" placeholder="请输入手机号" style="width: 200px" clearable @keyup.enter.native="getList(url)" />
    </div>
    <div class="list-btn">
      订单号:<Input v-model.trim="params.nid" placeholder="请输入订单号" style="width: 200px" clearable @keyup.enter.native="getList(url)" />
    </div>
    <!-- <div class="list-btn">
      结清时间:<DatePicker type="date" @on-change="startTime"  placeholder="选择开始时间" style="width: 200px" ></DatePicker>
      ～<DatePicker type="date" @on-change="endTime"  placeholder="选择结束时间" style="width: 200px"  ></DatePicker>
    </div> -->
    <div class="list-btn">
      <Button type="primary" @click="getList(url,'refresh')">搜索</Button>
    </div>
    <page-list :listTitle="listTitle" :list="list" :loading="loading" @selectItem="ids = $event;"></page-list>
    <page-button :current="params.pageCurrent"  :total="total" @changePageNum="params.pageCurrent = $event; getList(url)" @changePageSize="params.pageLimit = $event; getList(url)"></page-button>
  </div>
</template>

<script>
  import listMixin from '../../mixin/list'
  import pageList from '../../template/listTemplate'
  import pageButton from '../../template/pageBtnTemplate'
  export default {
    mixins:[listMixin],
    components: {
      pageList,
      pageButton,
    },
    methods:{
      get(s){
        console.log(s)
      }
    },
    data () {
      return {
        tag: {
          'title': '结清列表',
          'path': '/work/settle/list'
        },
        listTitle: [
          {
            title: '订单号',
            minWidth: 200,
            key: 'nid',
            align:'left',
          },

          {
            title: '用户姓名',
            key: 'realname',
            minWidth:110,
            align:'center'
          },
          {
            title: '手机号',
            key: 'phone',
            minWidth:140,
            align:'center',
            render: (h, params) => {
              let phone = params.row.phone;
              return h('div', `${phone.substr(0,3)}****${phone.substr(7)}`)
            }
          },
          {
            title: '借款金额(元)',
            key: 'loanMoney',
            minWidth:140,
            align:'center',
            render: (h, params) => {
              return h('div', this.toYuan(params.row.loanMoney))
            }
          },
          {
            title: '借款周期(天)',
            key: 'loanDay',
            minWidth:110,
            align:'center'
          },
          {
            title: '银行名称',
            key: 'bankName',
            minWidth:120,
            align:'center'
          },
          {
            title: '银行卡号',
            key: 'bankNum',
            minWidth:200,
            align:'center'
          },
          {
            title: '合同开始时间',
            key: 'borrowTime',
            minWidth:160,
            align:'center',
            render: (h, params) => {
              return h('div',this.getLocalTime(params.row.borrowTime))
            }
          },
          {
            title: '合同结束时间',
            key: 'repayTime',
            minWidth:160,
            align:'center',
            render: (h, params) => {
              return h('div',this.getLocalTime(params.row.repayTime))
            }
          },
          {
            title: '结清时间',
            key: 'clearTime',
            minWidth:160,
            align:'center',
            render: (h, params) => {
              return h('div',params.row.clearTime?this.getLocalTime(params.row.clearTime):'-—')
            }
          },
          /*{
            title: '应还金额',
            key: 'needRepayment',
            minWidth:100,
            align:'center',
            render: (h, params) => {
              return h('div', this.toYuan(params.row.needRepayment))
            }
          },*/
          {
            title: '已还金额',
            key: 'repaymentMoney',
            minWidth:100,
            align:'center',
            render: (h, params) => {
              return h('div', this.toYuan(params.row.repaymentMoney))
            }
          },

          {
            title: '状态',
            key: 'status',
            minWidth:110,
            align:'center',
            render: (h, params) => {// 状态 0正常 1部分还款 2结清 3逾期 4还款中
              let d = this.getType(params.row.status,'payStatus')
              return h('div',{
                style:{
                  color:d.color
                }
              },d.name)
            }
          },
        ],
        url: '/bkcontract/settle/list',
        nameListUrl: '',
        params: {
          //status:'',
          pageCurrent: 1,
          pageLimit: 10
        },

      }
    },
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
 .list-btn{
    margin-bottom: 5px;
    margin-right: 5px;
    display: inline-block;
  }
  .refresh-btn{
    float: right;
  }

</style>
